home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / Docs / ReadMe36c2 < prev    next >
Text File  |  1994-09-27  |  17KB  |  362 lines

  1.  
  2.                  W A R N I N G
  3.  
  4. The release of this document establishes public prior use of the name
  5. "ARMix" as referred to in this document. This document in it's entirety
  6. is (c) Copyright 1993 H.Rogers, all rights reserved. UNIX is a registered
  7. trademark of AT&T Corporation, Unix Systems Laboratories.
  8.  
  9.  
  10.                   N O T I C E
  11.  
  12. UnixLib v3.6c will be the _last_ release of UnixLib. UnixLib functionality
  13. will shortly be replaced by ARMix - a POSIX kernel extension to RiscOS
  14. with associated libraries. ARMix will provide virtual memory, preemptive
  15. scheduling, windowed terminals, full POSIX process and file management,
  16. BSD network library support, and support for an eventual port of the BSD
  17. filesystem. ARMix is scheduled for Alpha release in May 1993. Please
  18. contact the address at the end of this document for more information.
  19.  
  20. This version is being released as a stop gap measure to provide UnixLib
  21. users with some bugfixes. Do not base long term development on UnixLib
  22. any longer - it will shortly be obsolete and is no longer actively supported
  23. by the author. In particular code written for ARMix already providing
  24. superior functionality to UnixLib includes an interrupt driven POSIX compliant
  25. terminal driver with dynamically loadable hardware support modules, POSIX
  26. compliant RiscOS 3.10 filesystem interface, POSIX/BSD process management
  27. and signals, and a virtual memory system. The design of ARMix is completed -
  28. the work remaining is comparatively routine coding. UnixLib is very non
  29. compliant with POSIX - ARMix is written from scratch to be 100% POSIX
  30. compliant.
  31.  
  32.             H.Rogers    14/2/1993
  33.  
  34.  
  35.  
  36.             UnixLib v3.6c (29/8/1992)
  37.  
  38. This is a complete replacement ANSI compliant C library for use
  39. with Acorn RiscOS ANSI C Release 3.0/3.1A/3.1B/4.0. It incorporates a
  40. subset of the UNIX system call interface and some common System V and
  41. 4.3 BSD C libraries. There is *no* Acorn software in this library - take
  42. note Acorn! ;-)
  43.  
  44. Recent changes to UnixLib are documented towards the end of this file.
  45.  
  46. Directories marked '#' below contain proprietary source code. Source code
  47. in these directories is Copyright 1990/1991/1992 H.Rogers and XFM Software,
  48. and may only be distributed or modified in connection with UnixLib
  49. development. All other use or distribution is strictly prohibited.
  50. This entire paragraph and the list of directories below must be present
  51. in a file called "ReadMe" in a prominent place on all media used to
  52. distribute the aforementioned source code or derivations thereof. Failure
  53. to comply with the above requirements is breach of copyright and other
  54. international laws.
  55.  
  56.  
  57.     !Alias              * Alias file (see "ReadMe")
  58.     !Boot            !Boot for UnixLib maintenance
  59.     clib              * Library directory
  60.     clib.h              * UnixLib ANSI header files
  61.     clib.o              * UnixLib directory
  62.     clib.o.unixlib          * UnixLib itself
  63.     clib.sys.h          * UnixLib specific header files
  64.     etc              * UnixLib version of /etc
  65.     ReadMe              * Documentation for UnixLib - this file
  66.     src            Source code
  67.     src.ReadMe        Documentation for source code
  68.     src.o            UnixLib portable object code
  69.     src.c              # UnixLib portable source code
  70.     src.stdio.o        UnixLib stdio object code
  71.     src.stdio.c          # UnixLib stdio source code
  72.     src.unix.c        UnixLib UNIX emulation source code
  73.     src.unix.o        UnixLib UNIX emulation object code
  74.     src.sys.c        UnixLib RiscOS related source code
  75.     src.sys.s        UnixLib RiscOS related source code (ARM code)
  76.     src.sys.o        UnixLib RiscOS related object code
  77.     test            UnixLib test programs
  78.     test.ReadMe        Documentation for test programs
  79.  
  80.  
  81. Asterisked files/directories are those that are necessary to compile
  82. programs with UnixLib. If you are installing UnixLib onto a hard disk you
  83. are advised not to change the organization of the directory tree other than
  84. to move etc into the root directory, since updates will be issued with
  85. this structure.
  86.  
  87. !Alias *must* be executed before using this library. It contains necessary
  88. command line aliases that need to be set for the C compiler to work correctly
  89. with UnixLib. Comments in the file explain it. RTFM to see what the command
  90. line arg.s do. !Alias can of course be inserted into any other command file.
  91.  
  92. !Boot contains !Alias, and also sets up other aliases to facilitate
  93. maintenance of UnixLib. These are documented within the !Boot file.
  94.  
  95. All the header files, etc. are completely different from the Acorn
  96. equivalents. You *must* have the entire clib directory completely separate
  97. from any Acorn code or header files. If you do not have it called 'clib' in
  98. the root directory you may need to modify !Alias.
  99.  
  100. Csh style command line redirection is now inbuilt to UnixLib. UnixLib programs
  101. that are invoked direct from OS_CLI scan the command line for redirections at
  102. the same time as performing argument processing. UnixLib programs invoked as
  103. children of other UnixLib programs inherit the parent's file descriptor set
  104. (as in UNIX), and therefore do not perform this scanning. Redirection
  105. directives that are supported are: ">", ">>", ">&", ">>&", "<".
  106.  
  107. There are environment variables specific to UnixLib programs; some are new to
  108. v3.6c and others have had their names changed:
  109.  
  110.     Unix$uid: If set, then it's value is used to set the UNIX uid.
  111.  
  112.     Unix$tty: controls which terminal file programs use - if unset or set
  113. to "/dev/console" or "/dev/tty" then the console (Archimedes keyboard/screen)
  114. is assumed; if set to "/dev/rs423" then the RS423 port is used. Other names
  115. may be allocated in future for multiple serial I/O ports, Econet, etc. Note
  116. that these names may be used by UnixLib programs to open the corresponding
  117. devices.
  118.  
  119. All user settable environment variables particular to UnixLib are prefixed
  120. with Unix$ or UnixFS$. However certain state information internal to UnixLib
  121. is stored in variables prefixed with UnixLib$ - such variables should be
  122. ignored and not altered or deleted. UnixLib$dir (set by the !Alias command
  123. file in this distribution) is only used when compiling with UnixLib, and does
  124. not need to be set for UnixLib compiled programs to run.
  125.  
  126. The standard UNIX environment variables which control the behaviour of some
  127. of the C libraries are as normal - SHELL, TERM, TERMCAP, etc. Note that
  128. system() ignores the requirement for a shell if SHELL is unset, but calls
  129. SHELL with the '-c' option (as per UNIX) is it is set. I.e. if you have GNU
  130. bash in adfs::4.$.library you should set SHELL to "adfs::4.$.library.bash".
  131.  
  132.  
  133.     Filename conversion:
  134.  
  135. Programs compiled using UnixLib now intelligently scan pathnames (complex
  136. filenames consisting of components delimited by '/') and work out for
  137. themselves whether a RiscOS or UNIX initial component is being used. With
  138. very few exceptions existing RiscOS and UNIX applications will work
  139. without alteration.
  140.  
  141. Filename suffix translation can now be customised. The variable UnixFS$sfix
  142. can be set to a colon separated value list of filename suffixes that are to
  143. be aliased to RiscOS subdirectories. If it is unset the default list is
  144. "a:c:f:h:i:l:o:p:s:y". I.e. "hero.c" gets translated to "c.hero".
  145.  
  146. UNIX style pathnames can now contain RiscOS style components:
  147.  
  148.     /adfs::4/etc/passwd
  149.     adfs::4/etc/passwd
  150.     /adfs::4.etc.passwd
  151.     adfs::4.etc/passwd    all translate to:    adfs::4.$.etc.passwd
  152.  
  153.     <UnixLib$Dir>/clib/o
  154.     <UnixLib$Dir>.clib/o    all translate to:    <UnixLib$Dir>.clib.o
  155.  
  156.     <UnixLib$Dir>/clib.o    translates to:        <UnixLib$Dir>.o.clib
  157.  
  158.     /<UnixLib$Dir>/clib.o    translates to:        $.<UnixLib$Dir>.o.clib
  159.  
  160.     /SCSIFS::$/tmp/<Temp>    translates to:        SCSIFS::$.tmp.<Temp>
  161.  
  162.     $/clib
  163.     $.clib
  164.     /$.clib
  165.     /clib            all translate to:    $.clib
  166.  
  167.     @/clib
  168.     @.clib            both translate to:    @.clib
  169.  
  170.     clib            translates to:        clib
  171.  
  172.     ThisIsVeryLong##    translates to:        ThsIsVryLn
  173.  
  174.  
  175.     If there exists a directory called $.src.ulib.src.unix then:
  176.  
  177.     /src.ulib/src.unix/uname.c
  178.  
  179.     will translate to:
  180.  
  181.     $.src.ulib.src.unix.c.uname
  182.  
  183.     otherwise it will translate to:
  184.  
  185.     $.src/ulib.src/unix.c.uname
  186.  
  187.  
  188. Pathnames referring to UNIX devices (of the form "/dev/xxx") are treated
  189. specially and refer to appropriate devices. Unrecognised devices are
  190. translated to "xxx:". Current recognised devices are "/dev/tty",
  191. "/dev/console", "/dev/rs423" and "/dev/null".
  192.  
  193. Variables of the form UnixFS$/xxx are used to alias UNIX pathnames commencing
  194. "/xxx", "/usr/xxx" or "/var/xxx". I.e. UnixFS$/etc controls the translation
  195. of "/etc", "/usr/etc" and "/var/etc". The files in "etc" on the distribution
  196. disk should be present in this directory. If you have a hard disk, just one
  197. copy of "etc" should be present on the hard disk, and UnixFS$/etc should be
  198. set to something like "adfs::4.$.etc".
  199.  
  200. In a similar way, UnixFS$/tmp, UnixFS$/bin and UnixFS$/usr can be used to
  201. alias "/tmp", "/bin", and "/usr". Note however that UnixFS$/bin will be
  202. consulted to translate "/usr/bin" before UnixFS$/usr is consulted to
  203. translate "/usr". A pathname commencing "/xxx" where UnixFS$/xxx is unset
  204. defaults to "$.xxx". A pathname commencing "/usr/xxx" where UnixFS$/xxx is
  205. unset and UnixFS$/usr is unset defaults to "$.usr.xxx".
  206.  
  207. "/tmp" and "/usr/tmp" are used by UnixLib programs for temporary files.
  208. UnixFS$/tmp should be set to a suitable directory, preferably on a hard disk.
  209.  
  210. "/bin" and "/usr/bin" are expected by some UNIX software to contain standard
  211. UNIX utilities (ls, cat, sh, etc.). If necessary, UnixFS$/bin should be set
  212. to a directory containing UNIX utility programs.
  213.  
  214. "/pipe" is used to store temporary files for the pipe() system call.
  215. Preferably UnixFS$/pipe should be set to a directory on a hard disk or RAM
  216. disk for decent throughput.
  217.  
  218.     Filename conversion - details:
  219.  
  220. A pathname consists of a series of components delimited by '/'. If a component
  221. consists of a string like "dir.file", "dir.dir.file", etc. then the converter
  222. checks that "dir" (or "dir.dir" in the second example) exists. If it does
  223. then the component is considered to be a native RiscOS component and remains
  224. untranslated.
  225.  
  226. Any component starting with a RiscOS variable reference like "<Var>",
  227. "<Var>.Path" or "<Var>Path" is untranslated.
  228.  
  229. Any _initial_ component matching the following patterns remains untranslated:
  230.  
  231.     * A component commencing with a RiscOS filesystem and media specifier
  232. ("FS::Media.Path")
  233.     * A component commencing with a RiscOS media specifier (":Media.Path")
  234.     * A component commencing with a RiscOS filesystem specifier ("FS:Path")
  235.     * A component commencing with the root, current, library, upper,
  236. user-root, or previous directories ("$.Path", "@.Path", "%.Path", "^.Path",
  237. "&.Path", or "\.Path")
  238.  
  239. Initial components not matching these patterns will then be checked as
  240. described above, using the "UnixFS$/*" environment variables.
  241.  
  242. All translated components are checked for filename suffix processing as
  243. described above, using the "UnixFS$sfix" environment variable. Translated
  244. components are also intelligently truncated to 10 characters in length if
  245. necessary, firstly by removing vowels other than the first character, then by
  246. forcible truncation of any excess. I.e. "ReadMe_First.c" gets translated
  247. to "c.RdMe_First".
  248.  
  249.  
  250. Look at the header files for detailed technical information. "sys/syslib.h",
  251. "sys/unix.h", "sys/dev.h", and "sys/tty.h" deal with library specific stuff.
  252. "sys/os.h" provides a RiscOS interface. "sys/param.h" only defines MAXPATHLEN
  253. and MAXHOSTNAMELEN - some code may expect more from it. Note that all the
  254. ANSI prototypes for the system calls are in "unistd.h". The prototypes for
  255. the termcap library are in "termcap.h" (which is not a standard file).
  256.  
  257.  
  258. Summary of changes from earlier versions, and some notable features of v3.6c:
  259.  
  260.     * scanf() has been debugged (from v3.6b).
  261.     * The execve() system call has been further recoded. The return
  262. values of child processes are now correctly returned to the parent via
  263. wait(), and system() returns with this value or -1 on error.
  264.     * The handler for unknown SWIs is no longer activated - the WIMP
  265. generates spurious unknown X bit-set SWIs which halted UnixLib programs
  266. running under TaskWindow.
  267.     * The TIOCGWINSZ & TIOCSWINSZ ioctl()s are implemented, allowing
  268. UNIX programs to get and set the text & graphics window sizes. The termcap
  269. library has been updated to use these ioctl()s and has also been given
  270. a builtin termcap entry for "acorn0" which is used when /etc/termcap cannot
  271. be found.
  272.     * alloca() is now properly implemented and cooperates with setjmp()
  273. and longjmp() which have also been recoded.
  274.     * __uname() (UNIX -> RiscOS filenaming) has been recoded from 3.6b.
  275. It now works 99% of the time both with existing RiscOS applications and
  276. UNIX applications by 'intelligently' assessing whether a pathname is RiscOS
  277. or UNIX. The exact pattern matching process is detailed above.
  278.     * The file descriptor tables (both UNIX & stdio) have been increased
  279. to allow up to 64 open files (256 open files would imply overlarge tables -
  280. e.g. 10k for the UNIX FD table).
  281.     * x$remainder() & x$uremainder() are provided for backwards
  282. compatibility with old Release 3 compilers.
  283.     * Csh style command line redirection is supported and argv[0] is no
  284. longer scanned.
  285.     * The escape character is no longer altered by UnixLib. ioctl() now
  286. correctly reads & updates the escape character and status.
  287.     * UnixLib programs now work properly with !DDT - all writeable data
  288. and self modifying code segments in UnixLib are in AOF writeable areas.
  289.     * execl(), execve(), etc. are provided, and in conjunction with
  290. vfork() allow multiple levels of process stacking.
  291.     * system() has been debugged.
  292.     * getenv() no longer increases memory allocation every time it's
  293. called.
  294.     * vfork() is provided. Check the UNIX manual page for vfork() *before*
  295. compiling programs that call fork(). fork() is #defined to vfork() in
  296. "sys/unix.h". The porting effort required for process related code is
  297. substantially reduced by the provision of vfork(), but it's not completely
  298. eliminated. Don't expect things to work if you rely on vfork() as a total
  299. replacement for fork().
  300.     * pipe() is provided. Multiple pipes may be in existence at once.
  301.     * popen() is provided (both "r" and "w" types).
  302.     * memcpy() and memset() have been recoded and improved.
  303.     * time() & mktime() have been debugged.
  304.     * access() has been debugged.
  305.     * errno is now volatile int, and timezone is int.
  306.     * The direct/dirent portable directory routines have been recoded
  307. to cope with long filenames.
  308.     * mktemp() & mkstemp() are now provided as part of stdio, and have
  309. been debugged. Prototypes are in <stdio.h>.
  310.     * Various stdio related bugs have been ironed out (including those
  311. present in v3.4). Output is properly line buffered.
  312.     * The termcap library has been touched up - the old 'cd' capability
  313. in the acorn0 and acorn12 entries in /etc/termcap has been removed since
  314. termcap is not allowed to output '\n' or '\r'.
  315.     * stricmp(), strnicmp() and strichr() have been added (case insensitive versions). Also strdup().
  316.     * Signal handling has been improved (again). RiscOS errors generate
  317. SIGERR, and RiscOS hardware errors generate SIGEMT. SIGEMT is also raised on
  318. stack overflow. SIGSTAK no longer exists. Clib 3.75 has SIGSTAK and SIGOSERROR
  319. instead of SIGEMT and SIGERR respectively. UnixLib properly traps and can
  320. return from *all* signals.
  321.     * The command line is scanned in SVC mode, so memory page 0 can be set
  322. ReadOnly to trap dereferences of null pointers.
  323.     * All #defines of the form #define xxx xxx have been altered so
  324. Release 4.0 doesn't choke on them in -pcc mode.
  325.     * link() is now provided; it renames files. The majority of uses
  326. of link() (renaming, etc.) work with this arrangement.
  327.     * The stdio and vfork libraries are linked in using "weak links" -
  328. this means that code that doesn't use stdio won't get linked in with it, and
  329. the same for vfork(). The minimum executable size has been reduced to 24k.
  330.     * The RiscOS interface has been extended - see "sys/os.h". You can
  331. pass a null pointer to OS functions that store result registers in integer
  332. arrays, in which case no results are stored. E.g. os_swi(n,0) calls SWI n and
  333. assumes it doesn't require arguments. os_print() is useful for debugging
  334. messages as it guarantees output - note you must use OS newlines with this
  335. i.e. "\r\n" not just "\n" as in UNIX.
  336.     * The tty driver has been further debugged and improved, including
  337. provision of the RS423 interface. The tty driver no longer reinitialises
  338. the RS423 interface or the keyboard - it just inherits the current status.
  339.     * An exit handler is now installed, so e.g. os_cli("quit") will
  340. do the right thing and exit nicely.
  341.     * alarm() & SIGALRM are provided.
  342.     * malloc(), etc. have been substantially improved.
  343.     * Internal UnixLib I/O has been rewritten and improved. Using Unix$tty
  344. you can make UnixLib programs accept a variety of devices as the controlling
  345. terminal.
  346.     * open() now timestamps written files.
  347.     * getcwd() is provided - the prototype char *getcwd(void) is in
  348. "sys/unix.h". getcwd() returns a UNIX style name with the FS/drive in the
  349. initial component. E.g. "/adfs::UnixLib3_4/clib". This may cause problems
  350. with some programs which expect to be able to scan the returned string
  351. as if it were a native RiscOS pathname.
  352.     * ioctl() correctly updates the RS423 port with all appropriate
  353. baud rates, parity, word size, etc. as defined in "termio.h"
  354.  
  355.  
  356. Please report all bugs to me, and any suggestions for improvement.
  357.  
  358. I can be contacted at:
  359.  
  360. Mail:    Apt. #512, Lion Mansion, Motoki 1-2-11, Kawasaki-shi, Tokyo 210, Japan
  361. Email:    rogersh@fsj.co.jp
  362.